home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / cd-sup / gmplay / install < prev    next >
Text File  |  1999-01-01  |  13KB  |  601 lines

  1. ;
  2. ; GMPlay install script
  3. ; ---------------------
  4. ; © 1997 by Christian Buchner
  5. ;
  6. ; $VER: GMPlayInstall (28-May-97)
  7. ;
  8.  
  9. (set @app-name "GMPlay V1.3")
  10.  
  11. ; Set current version and revision
  12.  
  13. (set myver 1)
  14. (set myrev 3)
  15.  
  16. ; Do not allow Novice User (when running from Shell)
  17.  
  18. (if (= @user-level 0)
  19.     (set @user-level 1)
  20. )
  21.  
  22.  
  23. ;=============================================================================
  24. ; English strings
  25.  
  26. (set default_lang 4)
  27.  
  28. (set #welcomestring "GMPlay V1.3\n--------------\n©1995-97 by Christian Buchner & Alessandro de Luca\nGiftware, any donations welcome!\nPlease support the development of a fine program!\n")
  29. (set #whereprogram "Where shall I install GMPlay?\n A drawer called \"GMPlay\" will be created there.")
  30. (set #installwhat "Please select what parts of the\npackage you want to install.")
  31. (set #install0 "Install documentation (recommended)")
  32. (set #install1 "Install XPK libraries (recommended)")
  33. (set #install2 "Install the 14 bit sound driver (recommended)")
  34. (set #install3 "Install the IFF sound samples (recommended)")
  35. (set #install4 "Install the 14 bit calibration utility")
  36. (set #install5 "Install the example MIDI files")
  37. (set #install6 "Install GMDIR environment variable (recommended)")
  38. (set #copyprogram "Copying GMPlay executable")
  39. (set #wheredocs "Where shall I place the documentation guide?\nPerhaps you prefer the HELP: directory?")
  40. (set #copydocs "Copying documentation guide.")
  41. (set #wherelibs "Where do you want the libraries installed?\nMake sure that there is a LIBS: assign to that directory.")
  42. (set #copyxpk "Copying xpkmaster.library.")
  43. (set #copyshri "Copying xpk SHRI sublibrary.")
  44. (set #copysqsh "Copying xpk SQSH sublibrary.")
  45. (set #wheredrivers "Where do you want to install the sound drivers?")
  46. (set #SDGMDir "In the GMPlay SoundDrivers directory")
  47. (set #SDDevs  "In DEVS:SoundDrivers")
  48. (set #copy14bit "Copying 14 bit sound driver.")
  49.  
  50. (set #copytones "Copying tone samples (XPK SQSH packed!).")
  51. (set #copydrums "Copying drum samples (XPK SQSH packed!).")
  52. (set #copymaps "Copying map files.")
  53. (set #copycalib "Copying 14 bit calibration utility.")
  54. (set #copymidi "Copying example MIDI files (XPK SHRI packed!).")
  55. (set #addpathvar "Installing GMDIR environment variable.")
  56. (set #savepathvar "Saving GMDIR environment variable in ENVARC:")
  57. (set #gmdirhelp "The GMDIR environment variable will tell\nGMPlay where its program directory is located.\nIf you still have the GM: assign installed\nyou may remove it now. It is no longer needed.\n")
  58. (set #envarchelp "This step will copy the GMDIR environment\nvariable into your ENVARC: directory where\nit is safely stored on hard drive\nin order to survive resets.\n")
  59. (set #endmessage "GMPlay has been successfully installed.\nNote that GMPlay is a CLI-based program.\nPlease read the documentation.\nThen try playing the example songs.\n")
  60.  
  61. (complete 0)
  62.  
  63. ; Welcome the user
  64.  
  65. (welcome #welcomestring)
  66.  
  67.  
  68.  
  69. ; Find the location of an existing GMPlay installation
  70.  
  71. (set #GMDir (getassign "GM"))
  72.  
  73. (if (exists "ENV:GMDIR" (noreq))
  74.     (
  75.         (set #GMDir (getenv "GMDIR"))
  76.     )
  77. )
  78.  
  79.  
  80. ; remove any slash at the end of #GMDir (if present)
  81.  
  82. (if (strlen #GMDir)
  83.     (
  84.         (if (= (substr #GMDir (- (strlen #GMDir) 1) 1) '/')
  85.             (
  86.                 (set #GMDir (substr #GMDir 0 (- (strlen #GMDir) 1) ) )
  87.             )
  88.         )
  89.     )
  90. )
  91.  
  92.  
  93. ; Expand the path (and check if directory exists)
  94.  
  95. (if (strlen #GMDir)
  96.     (
  97.         (set #GMDir (expandpath #GMDir))
  98.     )
  99. )
  100.  
  101.  
  102. ; Now check the version of the current installation
  103.  
  104. ; default: Create a new installation
  105. (set #InstallChoice 2)
  106.  
  107. (if (strlen #GMDir)
  108.     (
  109.         (set #GMProg (tackon #GMDir "GMPlay"))
  110.         
  111.         (if (exists #GMProg)
  112.             (
  113.                 (set vernum (getversion #GMProg))
  114.                 (set ver (/ vernum 65536) )
  115.                 (set rev (- vernum (* ver 65536) ) )
  116.         
  117.                 (message (cat "Found an existing GMPlay installation in\n\n" #GMDir "\n\nInstalled Version: " ver "." rev "\n") )
  118.         
  119.                 (set #Choice0 "Update the old installation")
  120.                 (set #Choice1 "Reinstall (parts of) this installation")
  121.                 (set #Choice2 "Create a new installation")
  122.         
  123.                 (set #InstallDefault 0)
  124.                 
  125.                 (if  (>= rev myrev)
  126.                     (
  127.                         (set #Choice0 "")
  128.                         (set #InstallDefault 1)
  129.                     )
  130.                     (
  131.                         (set #Choice1 "")
  132.                     )
  133.                 )
  134.         
  135.                 (set #InstallChoice
  136.                     (askchoice
  137.                         (prompt "Please specify the type of installation")
  138.                         (help @askchoices-help)
  139.                         (choices #Choice0
  140.                              #Choice1
  141.                              #Choice2
  142.                         )
  143.                         (default #InstallDefault)
  144.                     )
  145.                 )
  146.             )
  147.         )
  148.     )
  149. )
  150.  
  151.  
  152. ; Update the old installation
  153.  
  154. (if (= #InstallChoice 0 )
  155.     (
  156.         (set #BackupDir  (tackon #GMDir "Backup"))
  157.         (set #TablesDir  (tackon #GMDir "Tables"))
  158.         (set #GuideFile  (tackon #GMDir "GMPlay.guide"))
  159.         (set #DriversDir (tackon #GMDir "SoundDrivers"))
  160.         (set #TonesDir   (tackon #GMDir "Tones"))
  161.         (set #DrumsDir   (tackon #GMDir "Drums"))
  162.         (set #ToneMap    (tackon #GMDir "ToneMap"))
  163.         (set #DrumMap    (tackon #GMDir "DrumMap"))
  164.         (makedir #BackupDir)
  165.         
  166.         (if (exists #TablesDir)
  167.             (
  168.                 (run (cat "Delete \"" #TablesDir "\" All Quiet Force")
  169.                     (prompt "Deleting the old Tables directory")
  170.                     (help "This is necessary because the format\nof the tables has changed.\n")
  171.                     (confirm)
  172.                 )
  173.             )
  174.         )
  175.         (if (exists #GuideFile)
  176.             (
  177.                 (delete #GuideFile
  178.                     (prompt "Deleting obsolete program documentation")
  179.                     (infos)
  180.                     (confirm)
  181.                 )
  182.             )
  183.         )
  184.         (if (exists #DriversDir)
  185.             (
  186.                 (run (cat "Delete \"" #DriversDir "\" All Quiet Force")
  187.                     (prompt "Deleting the old sound drivers directory")
  188.                     (help "This is necessary because you will\nrequire a new 14 bit sound driver.\nThis will be installed in DEVS:SoundDrivers")
  189.                     (confirm)
  190.                 )
  191.             )
  192.         )
  193.         (if (exists #TonesDir)
  194.             (
  195.                 (set #Choice
  196.                     (askchoice
  197.                         (prompt "Delete or backup the old tones?")
  198.                         (help @askchoices-help)
  199.                         (choices "Delete"
  200.                              "Backup"
  201.                         )
  202.                         (default 0)
  203.                     )
  204.                 )
  205.                 (if (= #Choice 0)
  206.                     (
  207.                         (run (cat "Delete \"" #TonesDir "\" All Quiet Force")
  208.                             (prompt "Deleting the old tones directory")
  209.                             (help "You will get new and better\ntones with the current release.\n");
  210.                             (confirm)
  211.                         )
  212.                     )
  213.                 )
  214.                 (if (= #Choice 1)
  215.                     (
  216.                         (run (cat "Rename \"" #TonesDir "\" To " #BackupDir "/")
  217.                             (prompt "Backing up the old tones directory")
  218.                             (help "You will find them in the Backup drawer.\n");
  219.                             (confirm)
  220.                         )
  221.                     )
  222.                 )
  223.             )
  224.         )
  225.         (if (exists #DrumsDir)
  226.             (
  227.                 (set #Choice
  228.                     (askchoice
  229.                         (prompt "Delete or backup the old drums?")
  230.                         (help @askchoices-help)
  231.                         (choices "Delete"
  232.                              "Backup"
  233.                         )
  234.                         (default 0)
  235.                     )
  236.                 )
  237.                 (if (= #Choice 0)
  238.                     (
  239.                         (run (cat "Delete \"" #DrumsDir "\" All Quiet Force")
  240.                             (prompt "Deleting the old drums directory")
  241.                             (help "You will get new and better\ndrums with the current release.\n");
  242.                             (confirm)
  243.                         )
  244.                     )
  245.                 )
  246.                 (if (= #Choice 1)
  247.                     (
  248.                         (run (cat "Rename \"" #DrumsDir "\" To " #BackupDir "/")
  249.                             (prompt "Backing up the old drums directory")
  250.                             (help "You will find them in the Backup drawer.\n");
  251.                             (confirm)
  252.                         )
  253.                     )
  254.                 )
  255.             )
  256.         )
  257.         (if (OR (exists #ToneMap) (exists #DrumMap) )
  258.             (
  259.                 (set #Choice
  260.                     (askchoice
  261.                         (prompt "Delete or backup the old mapfiles?")
  262.                         (help @askchoices-help)
  263.                         (choices "Delete"
  264.                              "Backup"
  265.                         )
  266.                         (default 0)
  267.                     )
  268.                 )
  269.                 (if (= #Choice 0)
  270.                     (
  271.                         (run (cat "Delete \"" #DrumMap "\" \"" #ToneMap "\" Quiet Force")
  272.                             (prompt "Deleting the mapfiles")
  273.                             (help "You will get new and better\nmapfiles with the current release.\n");
  274.                             (confirm)
  275.                         )
  276.                     )
  277.                 )
  278.                 (if (= #Choice 1)
  279.                     (
  280.                         (run (cat "Rename \"" #ToneMap  "\" \"" #DrumMap "\" To " #BackupDir "/")
  281.                             (prompt "Backing up the mapfiles")
  282.                             (help "You will find them in the Backup drawer.\n");
  283.                             (confirm)
  284.                         )
  285.                     )
  286.                 )
  287.             )
  288.         )
  289.     )
  290. )
  291.  
  292.  
  293. ; Ask for target directory (only if new installation desired)
  294.  
  295. (if (= #InstallChoice 2 )
  296.     (
  297.         (set #TargetDir
  298.             (askdir
  299.                 (prompt #whereprogram)
  300.                 (help @askdir-help)
  301.                 (default
  302.                     (expandpath
  303.                         (if (exists "Music:" (noreq))
  304.                             "Music:"
  305.                         (if (exists "Sound:" (noreq))
  306.                              "Sound:"
  307.                         (if (exists "Work:Music" (noreq))
  308.                              "Work:Music"
  309.                         (if (exists "Work:Sound" (noreq))
  310.                              "Work:Sound"
  311.                         (if (exists "Work:" (noreq))
  312.                              "Work:"
  313.                         "SYS:" )))))
  314.                     )
  315.                 )
  316.                 (newpath)
  317.             )
  318.         )
  319.         (set #DestDir (tackon #TargetDir "GMPlay"))
  320.         (makedir #DestDir (infos))
  321.     )
  322.  
  323.     ; ELSE: Install into existing directory!
  324.  
  325.     (
  326.         (set #DestDir #GMDir)
  327.     )
  328. )
  329.  
  330.  
  331. (complete 10)
  332.  
  333. ; Ask what parts of the program shall be installed
  334.  
  335. (set #InstFlags
  336.     (askoptions
  337.         (prompt #installwhat)
  338.         (help @askoptions-help)
  339.         (choices #install0
  340.              #install1
  341.              #install2
  342.              #install3
  343.              #install4
  344.              #install5
  345.              #install6
  346.         )
  347.     )
  348. )
  349.  
  350. (complete 20)
  351.  
  352. ; Copy GMPlay main program
  353.  
  354. (copyfiles
  355.     (prompt #copyprogram)
  356.     (help @copyfiles-help)
  357.     (source "GMPlay")
  358.     (dest #DestDir)
  359.     (infos)
  360.     (confirm)
  361. )
  362.  
  363. (complete 30)
  364.  
  365. ; Install GMPlay documentation
  366.  
  367. (if (BITAND #InstFlags 1)
  368.     (
  369.         (set #DocsDir
  370.             (askdir
  371.                 (prompt #wheredocs)
  372.                 (help @askdir-help)
  373.                 (default #DestDir)
  374.                 (newpath)
  375.             )
  376.         )
  377.         
  378.         (makedir #DocsDir)
  379.         
  380.         (copyfiles
  381.             (prompt #copydocs)
  382.             (help @copyfiles-help)
  383.             (source "GMPlay-Eng.guide")
  384.             (dest #DocsDir)
  385.             (infos)
  386.             (confirm)
  387.         )
  388.     )
  389. )
  390.  
  391. (complete 40)
  392.  
  393. ; Install XPK libraries
  394.  
  395. (if (BITAND #InstFlags 2)
  396.     (
  397.         (set #LibsDir
  398.             (askdir
  399.                 (prompt #wherelibs)
  400.                 (help @askdir-help)
  401.                 (default "LIBS:")
  402.                 (newpath)
  403.             )
  404.         )
  405.         
  406.         (set #CompDir (tackon #LibsDir "compressors"))
  407.         (makedir #LibsDir)
  408.         (makedir #CompDir)
  409.         
  410.         (copylib
  411.             (prompt #copyxpk)
  412.             (help @copylib-help)
  413.             (source "Libs/xpkmaster.library")
  414.             (dest #LibsDir)
  415.             (confirm)
  416.         )
  417.         
  418.         (copylib
  419.             (prompt #copyshri)
  420.             (help @copylib-help)
  421.             (source "Libs/compressors/xpkSHRI.library")
  422.             (dest #CompDir)
  423.             (confirm)
  424.         )
  425.         
  426.         (copylib
  427.             (prompt #copysqsh)
  428.             (help @copylib-help)
  429.             (source "Libs/compressors/xpkSQSH.library")
  430.             (dest #CompDir)
  431.             (confirm)
  432.         )
  433.     )
  434. )
  435.  
  436.  
  437. (complete 50)
  438.  
  439. ; Query for sounddriver destination directory
  440.  
  441. (if (BITAND #InstFlags 4)
  442.     (
  443.         (set #DriverSelect
  444.             (askchoice
  445.                 (prompt #wheredrivers)
  446.                 (help @askchoices-help)
  447.                 (choices #SDGMDir
  448.                      #SDDevs)
  449.                 (default 1)
  450.             )
  451.         )
  452.         
  453.         (if (= #DriverSelect 0)
  454.             (
  455.                 (set #DriverDir (tackon #DestDir "SoundDrivers"))
  456.                 (makedir #DriverDir)
  457.             )
  458.         )
  459.         
  460.         (if (= #DriverSelect 1)
  461.             (
  462.                 (set #DriverDir "DEVS:SoundDrivers")
  463.                 (makedir #DriverDir)
  464.             )
  465.         )
  466.     )
  467. )
  468.  
  469. ; Install 14 bit sound driver
  470.  
  471. (if (BITAND #InstFlags 4)
  472.     (
  473.         (copylib
  474.             (prompt #copy14bit)
  475.             (help @copylib-help)
  476.             (source "SoundDrivers/14bit.driver")
  477.             (dest #DriverDir)
  478.             (confirm)
  479.             (infos)
  480.         )
  481.     )
  482. )
  483.  
  484. (complete 60)
  485.  
  486. ; Install Tones, Drums, Mapfiles
  487.  
  488. (if (BITAND #InstFlags 8)
  489.     (
  490.         (copyfiles
  491.             (prompt #copytones)
  492.             (help @copyfiles-help)
  493.             (source "")
  494.             (pattern "Tones")
  495.             (dest #DestDir)
  496.             (confirm)
  497.         )
  498.         
  499.         (copyfiles
  500.             (prompt #copydrums)
  501.             (help @copyfiles-help)
  502.             (source "")
  503.             (pattern "Drums")
  504.             (dest #DestDir)
  505.             (confirm)
  506.         )
  507.         
  508.         (copyfiles
  509.             (prompt #copymaps)
  510.             (help @copyfiles-help)
  511.             (source "")
  512.             (pattern "MapFiles")
  513.             (dest #DestDir)
  514.             (confirm)
  515.         )
  516.     )
  517. )
  518.  
  519. (complete 70)
  520.  
  521. ; Copy 14 bit calibration program
  522.  
  523. (if (BITAND #InstFlags 16)
  524.     (
  525.         (copyfiles
  526.             (prompt #copycalib)
  527.             (help @copyfiles-help)
  528.             (source "14Bit_Calibration")
  529.             (dest #DestDir)
  530.             (infos)
  531.             (confirm)
  532.         )
  533.     )
  534. )
  535.  
  536. (complete 80)
  537.  
  538. ; Copy example MIDI files
  539.  
  540. (if (BITAND #InstFlags 32)
  541.     (
  542.         (copyfiles
  543.             (prompt #copymidi)
  544.             (help @copyfiles-help)
  545.             (source "")
  546.             (pattern "MIDI-Files")
  547.             (dest #DestDir)
  548.             (infos)
  549.             (confirm)
  550.         )
  551.     )
  552. )
  553.  
  554. (complete 90)
  555.  
  556. ; Set GMDIR environment variable
  557.  
  558. (if (BITAND #InstFlags 64)
  559.     (
  560.         (run (cat "SetEnv GMDIR \"" #DestDir "\"")
  561.             (prompt #addpathvar)
  562.             (help #gmdirhelp)
  563.             (confirm)
  564.         )
  565.         (run (cat "Copy ENV:GMDIR ENVARC:")
  566.             (prompt #savepathvar)
  567.             (help #envarchelp)
  568.             (confirm)
  569.         )
  570.     )
  571. )
  572.  
  573.  
  574. (complete 100)
  575.  
  576. ; Tell the user that the assign is no longer needed.
  577.  
  578. (if (getassign "GM")
  579.     (
  580.         (if    (askbool
  581.                 (prompt "Remove the obsolete GM: assign\nfrom your user-startup?")
  582.                 (help "You do no longer require the GM: assign.\nIt has been replaced with the GMDIR variable.\n")
  583.             )
  584.             (
  585.                 (startup "GMPlay"
  586.                     (prompt "Deleting the assign from your user-startup")
  587.                     (help @startup-help)
  588.                     (command "; GMPlay's GM: assign has been removed")
  589.                 )
  590.             )
  591.         )
  592.     )
  593. )
  594.  
  595. ; Say goodbye to the user
  596.  
  597. (message #endmessage)
  598. (exit (quiet))
  599.  
  600. ; End of File
  601.